# $Id$
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=pathological
pkgver=1.1.3
pkgrel=9
pkgdesc="A puzzle game with the same feel as frozen bubble"
arch=('i686' 'x86_64')
url="http://pathological.sourceforge.net/"
license=('GPL')
depends=('python2-pygame')
makedepends=('netpbm')
install=pathological.install
source=(http://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}-${pkgver}.tar.gz
        pathological.desktop pygame_181.patch encoding.patch)
sha1sums=('70b1c9e12704c7fd3b301aa90bceee2e8373b7b9'
          '9b57f854ce9621542d810a21c61325de343950d7'
          '6f0aa0f74a87bd53771f2db6d3117981c4f070d3'
          '7dbaa9ced7da0094280425a68b4c8db3382f230a')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -p0 < ../encoding.patch
  patch -p1 < ../pygame_181.patch
  sed -i 's|#!/usr/bin/python|#!/usr/bin/python2|' pathological.py
  sed -i 's|X11R6/include/X11|share|' Makefile
  sed -i 's|usr/games|usr/bin|' Makefile
}

build() {
  cd ${pkgname}-${pkgver}
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -D -m644 "${srcdir}/pathological.desktop" "${pkgdir}/usr/share/applications/pathological.desktop"
  chown root:games "${pkgdir}/var/games"
  chmod 775 "${pkgdir}/var/games"
  rm "${pkgdir}/var/games/pathological_scores"
}
